package br.edu.ufcg.ga.stopcondition;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class MaxGenerationsStopConditionTest {

	private MaxGenerationsStopCondition mgsc;

	@Before
	public void setUp() throws Exception {
		this.mgsc = new MaxGenerationsStopCondition(5);
	}

	@Test
	public void testReachedStopCondition() {

		int generation = 1;

		for (; generation < 5; generation++) {
			assertFalse(this.mgsc.reached(generation, 1.0));
		}

		assertTrue(this.mgsc.reached(generation, 1.0));

	}
}
